package com.shiyan.demo;

import java.io.IOException;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;

/**
 * Swagger配置
 * 
 * ProjectName：data-acquisition
 * ClassName：SwaggerConfig  
 * Description： 
 * @Author：zhangminghang
 * @version 
 * CreateTime：2018年8月1日 上午9:05:42
 * UpdateUser：zhangminghang
 * UpdateTime：2018年8月1日 上午9:05:42
 * UpdateNote：
 */
@Configuration
@EnableSwagger2
public class SwaggerConfig {

	@Bean
	public Docket createRestApi() throws IOException {
		return new Docket(DocumentationType.SWAGGER_2).apiInfo(apiInfo()).select().apis(RequestHandlerSelectors.basePackage("com.shiyan.demo")).paths(PathSelectors.any()).build();
	}

	private ApiInfo apiInfo() throws IOException {
		return new ApiInfoBuilder().title("誓言--------").termsOfServiceUrl("http://data.sicilon.com/").contact("sicilon").version("0.0.1").build();
	}
}
